package com.huiquan.framework.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.framework.domain.StaticData;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class StaticDataDao extends EnhancedBaseDao<StaticData> {

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "STATIC_DATA.";

	public StaticDataDao() {
		super(space);
	}
	
	@SuppressWarnings("unchecked")
	public List<StaticData> retrieveByCode(String codeType) {
		Map<String,  Object > param  = new HashMap<>();
		param.put("codeType", codeType);
		return (List<StaticData>)this.list(space + "RETRIEVE_LIST", param, sqlMapClient);
	}
	
	public int deleteWarn(String id) {
		return this.update(space + "DELETE_WARN", id, sqlMapClient);
	}
	
	public int update(String codeType ,String value) {
		Map<String,  Object > param  = new HashMap<>();
		param.put("codeType", codeType);
		param.put("value", value);
		return this.update(space + "UPDATE_BY_CODE_TYPE", param, sqlMapClient);
	}
}
